'use strict'


const koa = require('koa');
const cors = require('koa-cors');
const bodyparser = require('koa-bodyparser');
const router = require('./router');
const { Blog, sync } = require('./model');

let app = new koa();
sync().then(() => {
     Blog.bulkCreate([
         {
           title: '海贼王的诞生',
            digest: '大航海时代的终点',
             text: '800年前的历史正文',
             classify: 'D之一族',
            author: '？？？？',
         },
         {
             title: '蒙奇D路飞',
             digest: '20岁',
             text: '霸王色霸气',
             classify: '橡胶果实',
             author: '未来的海贼王',
         },
         {
            title: '诺诺罗亚索隆',
             digest: '21岁',
             text: '三千烦恼风',
            classify: '大剑士',
             author: '世界第一大剑士',
         },
     ])
 })


app.use(cors());
app.use(bodyparser());
app.use(router());

app.listen(8080);